

$(function(){
    $("#form").validate({
        rules:{
            username:{
                required:true,
                minlength:3
            },
            password:{
                required:true,
                minlength:3
            },
            home_phone:{
                required:true,
                minlength:6
            }
        },
        message:{
            username:{
                required:true,
                minlength:"输入错误"
            },
            password:{
                required:true,
                minlength:"输入错误"
            },
            home_phone:{
                required:true,
                minlength:"输入有误"
            }
        }
    });
    $('#number').blur(function(){
        $.ajax({
            type:"post",
            url:a,
            dataType:"json",
            data:{
                number:$('#number').val(),
            },
            success:function(msg){
               if(msg == 'true'){
                   layer.open({
                       content:'此手机号已注册,请重新输入！！',
                   });
                   //alert('此帐号已注册,请重新输入！！');
                   //$('#username').after("<span id='span'>此帐号已注册,请重新输入！！</span>");
               }
            }
        })
    });
    $('#email').blur(function(){
        $.ajax({
            type:"post",
            url:b,
            dataType:"json",
            data:{
                email:$('#email').val(),
            },
            success:function(msg){
                if(msg == 'true'){
                    layer.open({
                        content:'此邮箱已注册,请重新输入！！',
                    });
                    //alert('此帐号已注册,请重新输入！！');
                    //$('#username').after("<span id='span'>此帐号已注册,请重新输入！！</span>");
                }
            }
        })
    })
});


var zz=new RegExp("^0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8}$","i");
function test(obj){
    if(zz.test(obj.value)){
        //$("#span").innerHTML = "正确";
        $("#span_a").html("");
    }else{
        //$("#span").innerHTML = "错误";
        $("#span_a").html("手机号码错误 ");
    }
}
var rr=new RegExp("^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$","i");
function fun(obj){
    if(rr.test(obj.value)){
        //$("#span").innerHTML = "正确";
        $("#span").html("");
    }else{
        //$("#span").innerHTML = "错误";
        $("#span").html("邮箱错误 ");
    }
}
